<?php

use Monolog\Formatter\LineFormatter;
use Monolog\Handler\FirePHPHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;

if (!function_exists('custom_log')) {
    function custom_log($message=null,$content){
        // the default date format is "Y-m-d H:i:s"
        $dateFormat = "[ Y-n-j,g:i a ]";
        // the default output format is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"
        $output = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
        // finally, create a formatter
        $formatter = new LineFormatter($output, $dateFormat);
        // Create a handler
        $stream = new StreamHandler(LOG_PATH, LOG_LEVEL);
        $stream->setFormatter($formatter);
        // bind it to a logger object
        $logger = new \Monolog\Logger('custom');
        $logger->pushHandler($stream);
        $logger->pushHandler(new FirePHPHandler());
        $logger->addInfo($message,$content);
    }
}
